using Microsoft.Extensions.Options;
using Models;
using System.Threading.Tasks;

namespace Services
{
    public class EmailSender : IEmailSender
    {
        private readonly EmailSettings _emailSettings;
        private readonly ISmtpEmailSender _smtpEmailSender;

        public EmailSender(IOptions<EmailSettings> emailSettings, ISmtpEmailSender smtpEmailSender)
        {
            _emailSettings = emailSettings.Value;
            _smtpEmailSender = smtpEmailSender;
        }

        public async Task SendEmailAsync(string email, string subject, string message)
        {
            await _smtpEmailSender.SendEmailAsync(email, subject, message);
        }
    }
}